package com.itheima.reggie.dao;

import com.itheima.reggie.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CategoryDao {
    @Insert("insert into category values(null,#{type},#{name},#{sort}," +
            "#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void save(Category category);
    @Select("select * from category")
    List<Category> findAll();
    @Delete("delete from category where id=#{id}")
    void findById(Long id);
    @Update("update category set name=#{name},sort=#{sort},update_time=#{updateTime}," +
            "update_user=#{updateUser} where id =#{id}")
    void update(Category category);

    List<Category> findByType(@Param("type") Integer type);
    @Select("select * from category where id=#{categoryId}")
    Category findNameById(Long categoryId);

}
